package com.pojo;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan("com.pojo")   //注解扫描方式配置bean 加了ConponentScan注解后，就不需要去xml中配置bean了
public class ConfigFile {
    @Bean
    public Cat cat()
    {
        return new Cat();
    }
    @Bean
    public Master master() {
        Master master = new Master();
        master.setName("张三");
        master.setAge(18);
        master.setPet(PetShop.getCat());
        return master;
    }
}
